package com.cold.manage.mapper;

import com.cold.common.domain.DeviceDetails;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 设备详情
 */
public interface DeviceDetailsMapper {

    @Select("select d.code device_code,d.min_tem,d.max_tem,d.min_hum,d.max_hum,d.status device_status,\n" +
            "c.abbr company_name,h.code host_code,h.type host_type,a.name area_name\n" +
            "from cc_monitor_device d,cc_company c,cc_area a,cc_host h \n" +
            "where d.host_id = h.id and h.area_id = a.id and a.company_id = c.id;")
    @Results({
            @Result(property = "deviceCode",column = "device_code"),
            @Result(property = "hostName",column = "host_code"),
            @Result(property = "hostType",column = "host_type"),
            @Result(property = "areaName",column = "area_name"),
            @Result(property = "companyName",column = "company_name"),
            @Result(property = "minTem",column = "min_tem"),
            @Result(property = "maxTem",column = "max_tem"),
            @Result(property = "minHum",column = "min_hum"),
            @Result(property = "maxHum",column = "max_hum"),
            @Result(property = "deviceStatus",column = "device_status")
    })
    List<DeviceDetails> selectDeviceDetails();
}
